﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

// Reviewed

#pragma once
#include "Matrix3d.h"
#include "GbmpDefines.h"
#include "GbmpConstants.h"

namespace gcmp
{
    /// \brief Matrix3d的工具类
    ///
    /// 
    class GCMP_MATH_INTERFACE_EXPORT Matrix3dUtils
    {
    public:

        /// \brief   判断两个传入矩阵是否在给定误差下相等
        ///
        /// \param matrix1  传入矩阵
        /// \param matrix2  传入矩阵
        /// \param tolerance 给定误差
        /// \return  true: 相等 ，false: 不相等
        static bool IsEqual(const Matrix3d& matrix1, const Matrix3d& matrix2, double tolerance = gcmp::Constants::DOUBLE_EPS);

        /// \brief   二维点src左乘矩阵  result = point x matrix
        ///
        /// \param point  传入的二维点
        /// \param matrix  矩阵
        /// \return  返回的二维点
        static Vector2d PointMultiplyMatrix(const Vector2d& point, const Matrix3d& matrix);

        /// \brief   二维行向量src左乘矩阵,无视偏移信息   result = vec x matrix
        ///
        /// \param vec  传入的行向量
        /// \param matrix 矩阵
        /// \return  返回的二维点
        static Vector2d VectorMultiplyMatrix(const Vector2d& vec, const Matrix3d& matrix);
  
    };
}

